home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.4)
-
- import distutils.command.build_ext as distutils
- from distutils.dep_util import newer
- import os
- import sys
-
- def replace_suffix(path, new_suffix):
- return os.path.splitext(path)[0] + new_suffix
-
-
- class build_ext(distutils.command.build_ext.build_ext):
- description = 'Compiler SIP descriptions, then build C/C++ extensions (compile/link to build directory)'
-
- def _get_sip_output_list(self, sbf):
- '''
- Parse the sbf file specified to extract the name of the generated source
- files. Make them absolute assuming they reside in the temp directory.
- '''
- for L in file(sbf):
- (key, value) = L.split('=', 1)
- if key.strip() == 'sources':
- out = []
- for o in value.split():
- out.append(os.path.join(self.build_temp, o))
-
- return out
- continue
-
- raise RuntimeError, "cannot parse SIP-generated '%s'" % sbf
-
-
- def _find_sip(self):
- import sipconfig
- cfg = sipconfig.Configuration()
- return cfg.sip_bin
-
-
- def _sip_inc_dir(self):
- import sipconfig
- cfg = sipconfig.Configuration()
- return cfg.sip_inc_dir
-
-
- def swig_sources(self, sources, extension = None):
- if not self.extensions:
- return None
-
- if extension is not None:
- extension.include_dirs.append(self._sip_inc_dir())
- else:
- self.include_dirs.append(self._sip_inc_dir())
- if not os.path.isdir(self.build_temp):
- os.makedirs(self.build_temp)
-
- sip_sources = []
- sip_sources = _[1]
- other_sources = _[1]
- generated_sources = []
- sip_bin = self._find_sip()
- for sip in sip_sources:
- sipbasename = os.path.basename(sip)
- sbf = os.path.join(self.build_temp, replace_suffix(sipbasename, 'sbf'))
- out = self._get_sip_output_list(sbf)
- generated_sources.extend(out)
-
- return generated_sources + other_sources
-
-
- def _sip_compile(self, sip_bin, source, sbf):
- self.spawn([
- sip_bin,
- '-c',
- self.build_temp,
- '-b',
- sbf,
- source])
-
-
-